package com.yfp.client.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yfp.client.domain.MarCouponPackShop;
import com.yfp.client.domain.OrderCombo;
import com.yfp.client.domain.OrderDetail;
import com.yfp.client.domain.dto.SettleDTO;
import com.yfp.client.util.ResponseEnum;

import java.util.List;

/**
 *
 * @description 针对表【mar_coupon_pack_shop(礼包销售)】的数据库操作Service
 * @createDate 2024-10-22 09:53:40
 */
public interface MarCouponPackShopService extends IService<MarCouponPackShop> {

    /**
     * 根据状态查询礼包销售
     *
     * @param code
     * @param cityName
     * @return
     */
    List<MarCouponPackShop> listByStatus(Integer code, String cityName);

    /**
     * 减少库存
     *
     * @param comboDTOS
     */
    void decreaseStockQuantity(SettleDTO comboDTOS);

    /**
     * 更新库存
     *
     * @param newStocks
     */
    void updateCurrentStockById(MarCouponPackShop newStocks);

    /**
     * 更新库存
     *
     * @param newStocks
     */
    void updateCurrentStockAndPackNumByIds(List<MarCouponPackShop> newStocks);

    /**
     * 恢复库存
     *
     * @param orderCombo
     * @param orderDetails
     */
    void recoverStockQuantity(OrderCombo orderCombo, List<OrderDetail> orderDetails);

    /**
     * 发放优惠券
     *
     * @param userId
     * @param packShopId 礼包销售id
     */
    void giveCoupon(String userId, Long packShopId);

    /**
     * 校验是否可以发放
     *
     * @param couponId
     * @param couponPackId
     * @param clientId
     * @return
     */
    ResponseEnum verifyCouponBoolean(Long couponId, Long couponPackId, String clientId);

    /**
     * 发券
     *
     * @param couponId
     * @param clientId
     * @param couponPackId
     * @return
     */
    ResponseEnum verifyCoupon(Long couponId, String clientId, Long couponPackId);

    /**
     * 增加售出数量
     *
     * @param id
     */
    void addSoldQuantity(Long id);

    /**
     * 更新状态为售罄
     *
     * @param id
     */
    void updateStatusToSoldOut(Long id);
}
